<template>

    <el-row>
        <el-button-group>
            <el-button plain type="primary" @click="doctorSign()">医生签名</el-button>
            <el-button plain type="primary" @click="signUrl()">医生签名(网络)</el-button>
        </el-button-group>
        <el-button-group>
            <el-button plain type="primary" @click="popSignPanl('#patient-sign')">患者签名</el-button>
            <el-button plain type="primary" @click="popSignPanl('#patient-family-sign')">家属签名</el-button>
        </el-button-group>
    </el-row>
    
    <Editor doc="/doc/9001.html"  @DocLoaded="onDocLoaded" style="margin: 10px 0;"></Editor>
    
    <Source src="/code/Signature.vue"></Source>
    
    </template>
    
    
    <script setup>
    import Editor from '@/components/Editor.vue'
    import Source from '@/components/Source.vue'
    
    let editor = null
    //文档加载完成
    const onDocLoaded = function(e) {
         editor =  e.editor
    }
    
    //患者签名
    const popSignPanl = function(id) {
        console.log(editor.$(id))
        editor.$(id).trigger('dblclick')
    }

    //网络图片签名
    const signUrl = function() {
        editor.$('#doctor-sign').attr('src','https://ss0.baidu.com/7Po3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/eac4b74543a98226d07efeeb8a82b9014b90ebbb.jpg')
    }
    
    
    //医生签名
    const doctorSign = function() {
        editor.$('#doctor-sign').attr('src','')
    }
    
    </script>